Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Protect savestates while the threaded software renderer is running #1864

Merged
merged 31 commits into from
Jan 7, 2024

Conversation

JesseTG
Copy link
Contributor

@JesseTG JesseTG commented Oct 24, 2023

In upstream melonDS, the frontend has full control of when it takes savestates, so you can assume that the render thread won't try to run while a savestate is being taken or loaded.

I can't make that assumption, as libretro doesn't let cores control when savestates are taken. End result is this issue, which this PR aims to fix.

@JesseTG JesseTG changed the title Protect savestates while the threader renderer is running Protect savestates while the threaded software renderer is running Oct 24, 2023
@JesseTG JesseTG marked this pull request as ready for review October 29, 2023 20:52
@JesseTG
Copy link
Contributor Author

JesseTG commented Oct 29, 2023

Okay, I think I've fixed the crash that I cited, and without affecting performance.

Screenshot 2023-10-29 162921

That blue circle represents the only instance of lock contention in the trace file I took.

@JesseTG
Copy link
Contributor Author

JesseTG commented Nov 8, 2023

I'm about to refactor GPU and GPU3D to remove global state, so this branch is probably gonna change soon.

@JesseTG
Copy link
Contributor Author

JesseTG commented Jan 4, 2024

@RSDuck Would you mind taking a look at this PR when you have some time? I recall from our discussions on Discord that you have some reservations about it, but I'm not clear on what the issues are. This is probably one of the last PRs I need before I'm ready to release melonDS DS 1.0.

- It's recalculated anyway
- I liked the dialogue style, but oh well
- Taking the difference between two pointers results in the number of elements, not the number of bytes
- The real synchronization was the friends we made along the way
@RSDuck RSDuck merged commit 8143f54 into melonDS-emu:master Jan 7, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants